#include <iostream>
using std::cout;
using std::endl;
//定义了protected类型的构造函数的类
class Base{
//public:
protected:
    Base(int base)
    :_base(base)
    {

    }
public:
    void show(){
        cout << "Base::show()" << endl;
    }
private:
    int _base;
};
class Derived: public Base{
public:
    Derived(int derived, int base)
    :Base(base)
     ,_b(base * 2)
    ,_derived(derived)
    {

    }

private:
    int _derived;
    Base _b;
};

void test(){
    //设置protected构造函数之后，无法创建对象
    //因为构造函数是保护性的，无法在外部调用
    //Base base(1);error
    Derived d(1, 2);
    d.show();
}

int main()
{
    test();
    return 0;
}

